<template>
  <div class="hello">
    <h2>我是helloWorld.vue开始</h2>
    <h1>{{ msg }}</h1>
    <h2>我是helloWorld.vue结束</h2>
  </div>
</template>

<script>
  import data from '../mock/mock.js';
  export default {
    name: 'HelloWorld',
    data() {
      return {
        msg: 'Welcome to Your Vue.js App'
      }
    },
    created() {
      //使用axios的get请求
      this.$http.get('http://test.cn')//注意这行
              .then(res => {
                console.log(res.data);
                this.msg = res.data.name;
                console.log(this.msg)
              })
    }
  }
</script>

<style scoped>
  .hello {
    margin: 10px;
    background: #ededed;
  }

  h1,
  h2 {
    font-weight: normal;
  }

  ul {
    list-style-type: none;
    padding: 0;
  }

  li {
    display: inline-block;
    margin: 0 10px;
  }

  a {
    color: #42b983;
  }
</style>

